#include <QtGui/QApplication>
#include "Views/MainWindow.h"
#include "Style/ArthurStyle.h"
#include <QCleanlooksStyle>
#include <QDesktopServices>
#include <QDir>

QString orgName = QString("CodersLab");
QString appName = QString("DotGame");

void createDataDirsIfNotExist()
{
    QString dataPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
    QDir dataDir(dataPath);

    if(!dataDir.exists())
    {
       dataDir.mkpath(dataPath);
    }

}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setOrganizationName(orgName);
    a.setApplicationName(appName);
    createDataDirsIfNotExist();
    MainWindow w;
    w.setWindowTitle(QString("Dot Game"));
    QStyle *pStyle = new ArthurStyle();
    w.setStyle(pStyle);
    QList<QWidget *> widgets = qFindChildren<QWidget *>(&w);

    foreach (QWidget *w, widgets){
        w->setStyle(pStyle);
        w->setAttribute(Qt::WA_AcceptTouchEvents);
    }

    w.show();

    return a.exec();
}
